package org.hawk.gwt.ppc.scanner;

import java.io.IOException;

import org.hawk.gwt.ppc.javacc.JavaScanner;
import org.hawk.gwt.ppc.javacc.ParseException;

/**
 * This interface describe java source processor. It should be registered in
 * {@link JavaScanner} and mapped to specific node type.
 * @author alex.bereznevatiy@gmail.com
 */
public interface Processor {
	/**
	 * Visits some mapped node when it is opened. Token chain allows to check the current token
	 * and some tokens before and after the the current one. After that token chain
	 * can be either commit or skip to the specific token, but not before
	 * the last commit. Also token chain can be left unchanged.
	 * @param iterator
	 */
	void visitStart(TokenChain<? extends Token> iterator,int kind) throws ParseException, IOException;
	/**
	 * Visits some mapped node when it is closed. Token chain allows to check the current token
	 * and some tokens before and after the the current one. After that token chain
	 * can be either commit or skip to the specific token, but not before
	 * the last commit. Also token chain can be left unchanged.
	 * @param iterator
	 * @param kind - node kind that is just visited
	 * @throws IOException 
	 * @throws ParseException 
	 */
	void visitEnd(TokenChain<? extends Token> iterator,int kind) throws ParseException, IOException;
}
